package cn.tedu.car;

import java.util.Arrays;
import java.util.Random;

public class Test5 {
public static void main(String[] args) {
	int[] a=new int[]{98,1,81,49,96,83,68,95,34};
	z(a);
	z2(a);
	z3(a);
	z4(a);
}

public static void z(int[] a) {
	int i=new Random().nextInt(a.length);
	System.out.println(a[i]);
}

public static void z2(int[] a) {
	int max=a[0];
	int min=a[0];
	for(int i=0;i<a.length;i++) {
		if(max<a[i]) {
			max=a[i];
		}else if(min>a[i]) {
			min=a[i];
		}
	}
	System.out.println(max);
	System.out.println(min);
}

public static void z3(int[] a) {
	Arrays.sort(a);
	System.out.println(a[0]);
	System.out.println(a[a.length-1]);
}

public static void z4(int[] a) {
	int s=0;
	for(int i=0;i<a.length;i++) {
			s=s+a[i];
		}
	
	System.out.println(s);
	System.out.println(s/a.length);
}
}

